home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / lisp / energize / energize-font-lock.el < prev    next >
Encoding:
Text File  |  1995-03-25  |  3.0 KB  |  77 lines

  1. ;; interactive turn on and off of the font-lock-mode
  2. ;; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
  3.  
  4. ;; This file is part of XEmacs.
  5.  
  6. ;; XEmacs is free software; you can redistribute it and/or modify it
  7. ;; under the terms of the GNU General Public License as published by
  8. ;; the Free Software Foundation; either version 2, or (at your option)
  9. ;; any later version.
  10.  
  11. ;; XEmacs is distributed in the hope that it will be useful, but
  12. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. ;; General Public License for more details.
  15.  
  16. ;; You should have received a copy of the GNU General Public License
  17. ;; along with XEmacs; see the file COPYING.  If not, write to the Free
  18. ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20.  
  21. ;; This file is preloaded, but font-lock.el is not.
  22. ;; Make the font-lock faces exist at startup time, so that people can
  23. ;; mess with them in their .emacs file.
  24. ;;
  25. ;; They will be initialized either: from the resource db when the first
  26. ;; frame is created; or by font-lock.el when it is first loaded.
  27.  
  28. (make-face 'font-lock-comment-face)
  29. (make-face 'font-lock-doc-string-face)
  30. (make-face 'font-lock-string-face)
  31. (make-face 'font-lock-function-name-face)
  32. (make-face 'font-lock-keyword-face)
  33. (make-face 'font-lock-type-face)
  34.  
  35.  
  36. ;; Fontify Energize Error Log
  37. (defconst energize-log-font-lock-keywords 
  38.   (purecopy
  39.    '(("^ *Note:.*$"            . font-lock-string-face)
  40.      ("^ *Warning:.*$"            . font-lock-keyword-face)
  41.      ("^ *Error:.*$"            . font-lock-function-name-face)
  42.      ("^/.* file system is full\r?$"    . font-lock-function-name-face)
  43.      ))
  44.   "Expressions to highlight in the Energize Error Log.")
  45. (add-hook 'energize-log-mode-hook 'turn-on-font-lock)
  46.  
  47. ;; font-lock is a kludge.  Why does it have to be such a pain to configure?
  48. (defun energize-configure-font-lock-mode (on-p font-p less-p)
  49.   (setq font-p (or font-p (not (x-color-display-p))))
  50.   (cond (on-p
  51.      (add-hook 'c++-mode-hook 'turn-on-font-lock)
  52.      (add-hook 'c-mode-hook 'turn-on-font-lock)
  53.      (add-hook 'emacs-lisp-mode-hook 'turn-on-font-lock)
  54.      (add-hook 'lisp-mode-hook 'turn-on-font-lock))
  55.     (t
  56.      (remove-hook 'c++-mode-hook 'turn-on-font-lock)
  57.      (remove-hook 'c-mode-hook 'turn-on-font-lock)
  58.      (remove-hook 'emacs-lisp-mode-hook 'turn-on-font-lock)
  59.      (remove-hook 'lisp-mode-hook 'turn-on-font-lock)))
  60.   (cond (font-p
  61.      (remove-hook 'font-lock-mode-hook 'font-lock-use-default-colors)
  62.      (add-hook 'font-lock-mode-hook 'font-lock-use-default-fonts))
  63.     (t
  64.      (remove-hook 'font-lock-mode-hook 'font-lock-use-default-fonts)
  65.      (add-hook 'font-lock-mode-hook 'font-lock-use-default-colors)))
  66.   (cond (less-p
  67.      (remove-hook 'font-lock-mode-hook
  68.               'font-lock-use-default-maximal-decoration)
  69.      (add-hook 'font-lock-mode-hook
  70.            'font-lock-use-default-minimal-decoration))
  71.     (t
  72.      (remove-hook 'font-lock-mode-hook
  73.               'font-lock-use-default-minimal-decoration)
  74.      (add-hook 'font-lock-mode-hook
  75.            'font-lock-use-default-maximal-decoration))))
  76.  
  77.